<template>
	<view class="container">
		<!-- <u-navbar bgColor="#0065FF" titleStyle="color:#fff;" leftIconColor="#fff" :title="dataInfo.project.title"
			autoBack placeholder></u-navbar> -->
		<view class="content">
			<view class="header">
				<!-- <view class="price"> 
					<text>竞标总价：{{ allPrice }}</text>
				</view> -->
				<view class="menu">
					<!-- <text>项目</text> -->
					<text>公司</text>
					<text>总价</text>
					<text>状态</text>
				</view>
			</view>
			<view class="list">
				<view class="item" v-for="(item, index) in recordList" :key="index" @click="reaoInfo(item)">
					<!-- <text>{{ item.project.title }}</text> -->
					<text>{{ item.companyName }}</text>
					<text>{{ item.allMoney }}</text>
					<text
						:class="[item.status == 0 ? 'status_0' : item.status == 1 ? 'status_1' : 'status_2']">{{ item.status | statusFilter }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				allPrice: 0,
				projectId: null,
				dataInfo: {},
				recordList: []
			};
		},
		filters: {
			statusFilter(e) {
				const info = {
					0: '竞标中',
					1: '竞标失败',
					2: '竞标成功'
				};
				return info[e];
			}
		},
		onLoad(e) {
			this.projectId = e.projectId
			this.getRecord()
			uni.setNavigationBarTitle({
				title: e.projectName
			});

		},
		methods: {
			reaoInfo(e) {
				if (e.deptId == this.$store.state.user.dept.deptId) {
					// console.log(e.project.content)
					console.log(e)
					uni.navigateTo({
						url: `/pagesB/project/logInfo?logId=${e.id}&projectId=${e.projectId}`
					});
				}
			},
			async getRecord(id) {
				this.$api.seeProjectLog({
					projectId: this.projectId,
					pageNum: 1,
					pageSize: 100
				}).then((response) => {
					this.recordList.push(...response.rows);
				})
				return
				const {
					data
				} = await this.$api.projectLogInfo({
					project_id: id
				});
				console.log(data)
				// data.project_log.data.length < this.limit ? (this.status = 'nomore') : (this.status = 'loadmore');
				this.recordList.push(...data.project_log);
			},
		}
	};
</script>

<style lang="scss" scoped>
	.status_0 {
		color: #999;
	}

	.status_1 {
		color: #f56c6c;
	}

	.status_2 {
		color: #5ac725;
	}

	.left {
		display: flex;
		color: #fff;
		align-items: center;
		font-size: 24rpx;
	}

	.price {
		font-size: 28rpx;
		padding: 20rpx;
		display: flex;
		justify-content: flex-end;
		text-align: right;
	}

	.header {
		position: fixed;
		width: 100%;
		padding: 20rpx;
		background-color: #fff;
		box-sizing: border-box;
		font-size: 24rpx;
		font-weight: bold;

		.menu {
			// margin-top: 20rpx;
			display: flex;

			>text:nth-of-type(1) {
				width: 60%;
			}

			>text:nth-of-type(2) {
				width: 20%;
			}

			>text:nth-of-type(3) {
				width: 20%;
			}

			>text:nth-of-type(4) {
				width: 25%;
			}
		}
	}

	.list {
		padding: 60rpx 20rpx;

		.item {
			display: flex;
			font-size: 24rpx;
			padding: 20rpx 0;
			border-bottom: 1rpx dotted #ddd;

			>text:nth-of-type(1) {
				width: 60%;
				padding-right: 5px;
			}

			>text:nth-of-type(2) {
				width: 20%;

			}

			>text:nth-of-type(3) {
				width: 20%;
			}

			>text:nth-of-type(4) {
				width: 25%;
			}
		}
	}
</style>